package com.mobimap.nhom9.gui.DataInfo;



import android.graphics.Bitmap;
import android.graphics.BitmapFactory;


public class MapInfo {
	private Point earthPoint;
    private Point tile;
    private Size size;  
    private int zoom;
    private String source;
    private String sourceBackup;
	
	public String getSourceBackup() {		
		return sourceBackup;
	}	
	
	public Point TileStartPoint() {
		Point titeStartPoint= new Point(getEarthPoint().getLogitude() - getEarthPoint().getLogitude() % 256,
						getEarthPoint().getLatitude() - getEarthPoint().getLatitude() % 256);           
		return titeStartPoint;
	}
	public void setSourceBackup(String sourceBackup) {
		this.sourceBackup = sourceBackup;
	}
	public String getSource() {
		return source;
	}
	public void setSource(String source) {
		this.source = source;
	}

	public Point getEarthPoint() {
		return earthPoint;
	}

	public void setEarthPoint(Point earthPoint) {
		this.earthPoint = earthPoint;
	}

	public Point getTile() {
		return tile;
	}

	public void setTile(Point tile) {
		this.tile = tile;
	}
	 public Point GetTileFromEarthPoint()
     {
         tile = new Point(earthPoint.getLogitude() / 256, earthPoint.getLatitude() / 256);
         return tile; 
     }

	public Size getSize() {
		return size;
	}

	public void setSize(Size size) {
		this.size = size;
	}

	public int getZoom() {
		return zoom;
	}

	public void setZoom(int zoom) {
		this.zoom = zoom;
	}
	
	public String getIdMap(){
		  String name= "a_" + zoom + "_" + tile.getLogitude() + "_" + tile.getLatitude();          
          return name;
	}
	
	 public Bitmap GetMapFromByte(byte[] data)
     {         
		 Bitmap map = BitmapFactory.decodeByteArray(data, 0, data.length);
         return map;
     }
	 
	/* public byte[] ConvertToByte(Image image)
     {
         Bitmap map = new Bitmap(image);
         MemoryStream ms = new MemoryStream();
         map.Save(ms, ImageFormat.Jpeg);
         byte[] byteResult = ms.ToArray();
         ms.Close();
         map.Dispose();
         return byteResult;
     }*/

     /*public byte[] ConvertToByte()
     {
         Bitmap map = new Bitmap(FullPath);
         MemoryStream ms = new MemoryStream();
         map.Save(ms, ImageFormat.Png);
         byte[] byteResult = ms.ToArray();
         ms.Close();
         map.Dispose();
         return byteResult;

     }*/
	
}


   
   
